package it.pizzastorm.domain.common;

import java.util.Comparator;

public class OrderComparator implements Comparator<Ordered> {
	private final static OrderComparator instance = new OrderComparator();

	private OrderComparator() {
	}

	public int compare(Ordered o1, Ordered o2) {
		int i1 = o1.getOrder();
		int i2 = o2.getOrder();
		return (i1 < i2) ? -1 : (i1 > i2) ? 1 : 0;
	}

	public static OrderComparator getInstance() {
		return instance;
	}
}
